import java.awt.*;
import java.awt.event.*;

import javax.swing.*;



public class Botao extends JPanel implements MouseListener,MouseMotionListener 
{
    private String imagem;
    private int posX;
    private int posY;
    private int sizeX;
    private int sizeY;
    private Mundo M;
    private boolean toPlay = true;
    
    public Botao(String img, int x, int y, int sx, int sy, Mundo m)
    {
        imagem = img;
        posX = x;
        posY = y;
        sizeX = sx;
        sizeY = sy;
        M = m;
    	this.addMouseListener(this);
    	this.addMouseMotionListener(this);
    }
    
	public int getSizeX()
	{
		return sizeX;
	}
	
	public int getSizeY()
	{
		return sizeY;
	}
	
	public int getX()
	{
		return posX;
	}
	
	public int getY()
	{
		return posY;
	}
	
	public String getImagem()
	{
		return imagem;
	}
 	public void mouseDragged(MouseEvent e)
	{

	}
	
	public void mouseExited(MouseEvent e)
	{
	
	}
	
	public void mouseMoved(MouseEvent e)
	{
		
	}
	
	public void mouseEntered(MouseEvent e)
	{
		
	}
	
	public void mouseClicked(MouseEvent e)
	{
		
	}
	
	public void mouseReleased(MouseEvent e)
	{

	}
	
	public void mousePressed(MouseEvent e)
	{
	   if (toPlay){
		if(((e.getX() >= posX) && (e.getX() <= (posX +  sizeX)) && ((e.getY() >= posY) && (e.getY() <= (posY + sizeY)))))
		{
			M.setcurrentStatePlay();
			toPlay = false;
		}
		else
		{
			M.setcurrentStateStop();
			toPlay = true;
		}
	   
	   }

	}
}
